package util;

import java.awt.Graphics2D;
import java.awt.image.BufferedImage;

public class ImageUtil {
	public static BufferedImage resizeImage(BufferedImage originalImage,
			int width, int height) {
		int type = originalImage.getType() == 0 ? BufferedImage.TYPE_INT_ARGB
				: originalImage.getType();

		BufferedImage resizedImage = new BufferedImage(width, height, type);
		Graphics2D g = resizedImage.createGraphics();
		g.drawImage(originalImage, 0, 0, width, height, null);
		g.dispose();

		return resizedImage;
	}
}
